package com.cw.demo.websocket.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import com.cw.demo.websocket.enums.EnumCmd;
import com.cw.demo.websocket.server.NettyServerHandler;
import com.cw.demo.websocket.server.ServerChannelCache;

/**
 * TODO
 *
 * @author chenw
 * @date 2021/1/11
 */
@Controller
@RequestMapping("")
public class IndexController {
    @Autowired
    private NettyServerHandler nettyServerHandler;
    @Autowired
    private ServerChannelCache cache;
    @GetMapping("/")
    public String index(){
        return "index";
    }
    @GetMapping("/hello")
    public void hello(){
        nettyServerHandler.send(EnumCmd.START,"111","hello");
    }
}
